package com.kerrykidz.system.controller;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kerrykidz.workflow.service.IWorkflowService;
import com.rdp.framework.exception.RDPException;

/**
 * url跳转类
 * @author zhuss
 */
@Controller
public class UrlController {
	 @Autowired
	 private IWorkflowService workflowService;

	//跳转登录页面
    @RequestMapping(value = "/login")
    public String login() {
    	if(SecurityUtils.getSubject().isAuthenticated()){
    		return "redirect:/system/user/logonSuccess.shtml";
    	}
        return "login";
    }
    
  //跳转pad登录页面
    @RequestMapping(value = "/padLogin")
    public String padLogin() {
    	if(SecurityUtils.getSubject().isAuthenticated()){
    		return "redirect:/system/user/padLogonSuccess.shtml";
    	}
        return "padLogin";
    }
  /*  //跳转首页
    @RequestMapping(value = "/index")
    public String index() {
    	System.out.println(SecurityUtils.getSubject().isAuthenticated());
        return "index";
    }*/
    
    @RequestMapping("/deploy")
	 public String deploy(String key) throws RDPException {
		 workflowService.deploy(key);
		 return "login";
	 }
    
	@RequestMapping("/error")
	 public String error(String key) {
		 return "error/500";
	 }
}
